@echo off

REM osql -S %1 -E -b -n -q "IF EXISTS(SELECT * FROM sysdatabases WHERE name = '%2') BEGIN DROP DATABASE %2 END"
REM osql -S %1 -E -b -n -q "CREATE DATABASE %2"

REM osql -S %1 -d %2 -E -b -i Security.sql -n
osql -S %1 -d %2 -E -b -i Tables.sql -n

if '%3' == '-nodata' goto done

echo Loading test data

..\Tests\UnitTests\bin\Debug\Mindscape.BackgroundMotion.UnitTests.exe %2

:done

echo Finished building %2

@echo on


